<template>
    <div class="main">
        <div class="searchDiv1">
            <!-- <x-input title="title"
                     v-model="name"
                     :show-clear="false"></x-input> -->
            <div class="search-wrap">
                <input type="text"
                       v-model="name"
                       placeholder="请输入关键字查询">
                <button @click="hiddlechange"></button>
            </div>
        </div>
        <noData v-if="positionlist.length == 0"></noData>
        <div class="showlist"
             v-for="(item,index) in positionlist"
             :key="index"
             @click="positionselect(item)">
            {{item.name}}
        </div>
        <myMenu></myMenu>

    </div>

</template>

<script>
import { XHeader } from 'vux'
import myMenu from '@/commonComponents/menu'

export default {
    name: 'App',
    data () {
        return {
            name: '', // 搜索关键字
            positionlist: '',
            positionArea: '',
            userId: '',
            tokenId: '',
            projectId: '',
            userInfo: ''
        }
    },
    components: {
        XHeader,
        myMenu
    },
    created () {
        console.log(this.$router, 990)
        this.userInfo = JSON.parse(localStorage.userInfo)
        this.userId = this.userInfo.userid
        this.tokenId = this.userInfo.tokenId
        this.projectId = this.userInfo.deptid
        this.hiddlechange()
    },
    methods: {
        hiddlechange () {
            let param = {
                'allowPaging': true,
                'business': 'getPersonPage',
                'data': {
                    'DepartId': this.projectId,
                    'Name': this.name
                },
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': this.tokenId,
                'userId': this.userId

            }
            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    if (res.data.code === 0) {
                        this.positionlist = res.data.data
                    }
                }
            )
        },
        positionselect (item) {
            this.$store.state.userInfo = item
            this.$router.go(-1)
            // this.$router.push('/hideRegister')
        }
    }
}
</script>

<style scoped lang="less">
.main {
    background-color: #fff;
}

.showlist {
    height: 40px;
    line-height: 40px;
    color: #999;
    font-size: 14px;
    padding: 0 20px;
    border-bottom: 1px solid #ccc;
}
.searchDiv1 {
    display: flex;
    align-items: center;
    height: 60px;
    background: #ebeef3;
    padding: 0 20px;
    overflow: hidden;
}
.search-wrap {
    display: flex;
    justify-content: center;
    height: 40px;
    margin: 10px auto;
    border-radius: 8px;
    background: #fff;
    padding: 10px 15px;
    flex: 1;
    input {
        height: 20px;
        flex: 1;
        font-size: 14px;
        color: #666;
    }
    button {
        width: 24px;
        height: 25px;
        background: url(../../../../static/images/s_03.png) no-repeat center
            #fff;
        background-size: 24px 25px;
    }
}
</style>
<style>
.searchDiv1 .weui-cells {
    margin-top: 0;
    height: 40px;
    background: #fff;
    border-radius: 8px;
}
.searchDiv1 .vux-cell-value {
    font-size: 14px;
}
.searchDiv1 .weui-cell_access .weui-cell__ft::after {
    border-bottom-width: 2px;
    border-top-width: 0;
    top: -2px;
}
</style>
